]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
[messageTray] Fix text with ampersands not being displayed
authorFlorian Müllner <fmuellner@src.gnome.org>
Sat, 20 Feb 2010 03:28:47 +0000 (04:28 +0100)
committerFlorian Müllner <fmuellner@src.gnome.org>
Sun, 21 Feb 2010 02:54:06 +0000 (03:54 +0100)
If the notification body contains '&' it ends up empty and a warning
about an invalid entity is printed on stderr, so our escape code must
handle ampersands as well.

https://bugzilla.gnome.org/show_bug.cgi?id=607375

js/ui/messageTray.js

index 039685a1c96fc903a86ca271b87d2ade94e29a9b..06dd250bb94ba656c7f8d5f8fb8a84792469be02 100644 (file)
@@ -27,9 +27,12 @@ const State = {
 };
 
 function _cleanMarkup(text) {
+    // Support &amp;, &quot;, &apos;, &lt; and &gt;, escape all other
+    // occurrences of '&'.
+    let _text = text.replace(/&(?!amp;|quot;|apos;|lt;|gt;)/g, "&amp;");
     // Support <b>, <i>, and <u>, escape anything else
     // so it displays as raw markup.
-    return text.replace(/<(\/?[^biu]>|[^>\/][^>])/g, "&lt;$1");
+    return _text.replace(/<(\/?[^biu]>|[^>\/][^>])/g, "&lt;$1");
 }
 
 // Notification:
@@ -295,7 +298,6 @@ Notification.prototype = {
     popIn: function() {
         if (this.actor.row_count <= 1)
             return false;
-
         Tweener.addTween(this._bannerLabel,
                          { opacity: 255,
                            time: ANIMATION_TIME,